<template>
  <div>
   <div class="file_list">
      <van-cell  style="display: flex;" >
        <input class="cell_begin" type="text" placeholder="请选择治疗开始时间" @click="show = true"  :value="date"  />
        <el-icon class="begin_icon"><CaretBottom /></el-icon>
      </van-cell>
      <van-calendar row-height="70"  title="治疗时间" color="#1989fa" :min-date="minDate" confirm-text="确认治疗开始时间" :max-date="maxDate" v-model:show="show"  @confirm="onConfirm" />
      </div>
  </div>
</template>

<script setup lang="ts">

import { useRouter } from 'vue-router'
import { h, ref, shallowRef } from 'vue'
  const date = ref('');
    const show = ref(false);

    const  minDate= new Date(2024, 1, 1)
const  maxDate= new Date(2025, 12,31)

    const formatDate = (date) => {
      return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
    };
    const onConfirm = (value) => {
      show.value = false;
      date.value = formatDate(value);
       localStorage.setItem('time1', date.value)
    };
    // 把date.value 存到本地仓库
</script>

<style scoped>
.cell_begin{
  width: 100%;
  margin: 7.5px;
  margin-left: 12.5px;
  padding-bottom: 7.5px;
  border: none;
  font-size: 12px;
  border-bottom: solid 0.5px #ccc;
}

.begin_icon{
  position: absolute;
  top: 7.5px;
  right: 32.5px;
}

</style>
